<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>资料录入</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="stylesheet" href="/static/wx/lib/sui/sm.min.css">
    <link rel="stylesheet" href="/static/wx/lib/sui/sm-extend.min.css">
    <link rel="stylesheet" href="/static/wx/css/reset.css">
    <link rel="stylesheet" href="/static/wx/css/main.css">
    <link rel="stylesheet" href="/static/wx/css/public_main.css">
</head>

<body>
    <div class="page-group">
        <div class="page page-current" id="filerecord">

            <!-- 主内容 -->
            <div class="content">
                <div class="setp-card">
                    <div class="step-box">
                        <div class="step-item selected">
                            <div class="step-item-line">
                                <span></span>
                            </div>
                            <div class="step-item-text size-65">保单险种</div>
                        </div>
                        <div class="step-item selected">
                            <div class="step-item-line">
                                <span></span>
                            </div>
                            <div class="step-item-text size-65">货品信息</div>
                        </div>
                        <div class="step-item selected">
                            <div class="step-item-line">
                                <span></span>
                            </div>
                            <div class="step-item-text size-65">货品受损</div>
                        </div>
                        <div class="step-item selected">
                            <div class="step-item-line">
                                <span></span>
                            </div>
                            <div class="step-item-text size-65">货品现状</div>
                        </div>
                        <div class="step-item selected">
                            <div class="step-item-line">
                                <span></span>
                            </div>
                            <div class="step-item-text size-65">物权信息</div>
                        </div>
                        <div class="step-item selected">
                            <div class="step-item-line">
                                <span></span>
                            </div>
                            <div class="step-item-text size-65">递交授权</div>
                        </div>
                    </div>
                    <div class="size-65 text-c">
                        以下资料作为法律责任依据请如实填写，<span class="blue">查看模版>></span>
                    </div>
                </div>
                <div class="bs-box" style="background:#fff;">
                    <div class="bs-box-content">
                        <div class="bs-box-inner">
                            <div class="author-book">
                                <h3 class="text-c">授权书</h3>
                                <p class="book-content">
                                    今授权上海沪东拍卖有限公司，对报案号<u>{$policy_num|default='_________'}</u>
                                    的保险损余物品标的物进行处置，相关资料（物品清单、相关描述、质量和瑕疵等）均已如实在平台上提供，并已递交物权人<u>{$user|default='_________'}</u> 进行确认。
                                </p>
                                <p class="book-content">
                                    拍卖处置方式由物权人与上海沪东拍卖有限公司签订授权书。
                                </p>
                                <p class="book-content">本授权期限至此标的物处置结束止。</p>
                                <p class="book-stamp"> 授权单位（盖章）</p>
                                <p class="book-signature">授权人（签字）</p>
                            </div>
                            <p class="size-65 text-c" style="padding:.2rem 0;border-top:1px solid #ddd;border-bottom:1px solid #ddd;">此授权书为格式文档,点击右上角分享打印盖章后上传</p>
                            <div class="bs-box-content-item border-b-none" id="uploadHtml">
                                <p class="size-m">上传授权书</p>
                                <ul class="uploader-files" id="uploader-files">
                                </ul>
                                <div class="uploader">
                                    <div class="uploader-content">
                                        <div class="uploader-input-box"><input type="file" accept="image/*" class="uploader-input" onchange="handleInputChange1(event)"></div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <input type="hidden" value="{$policy_num}" name='policy_num'/>
                <div class="btn-box" style="margin-top: 1rem;">
                    <div class="flex">
                        <div class="pre-step my-btn" style="width:47%;" @click="preStep" id="preStep">
                            <span style="background-color: #fff;color:#000;">上一步</span>
                        </div>
                        <div class="pre-step my-btn" style="width:47%" @click="nextStep" id="nextStep">
                            <span class="active">递交审核</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </div>
    </div>
    <script type='text/javascript' src='/static/wx/lib/sui/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/static/wx/lib/sui/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/static/wx/lib/sui/sm-extend.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='/static/wx/js/upload.js' charset='utf-8'></script>
    <script>
        $(function () {
            var n = $('.step-box').children().length;
            $('.step-item').css('width', document.body.clientWidth / n + 'px')
            $(document).on('click', '#preStep', function () {
                var poliecy = $("input[ name='policy_num']").val();
                location.href = "{:url('insurer/step5')}?policy_num=" + poliecy;
            });
            $(document).on('touchend', '#nextStep', function () {

                $.confirm('资料先递交系统进行审核\n' + '\n' + '审核通过后系统将递交给物权人确认\n' + '\n' + '确认后消息提醒你', function () {
                    var poliecy = $("input[ name='policy_num']").val();
                    var arr='';
                    var  obj=$("#uploader-files  li");
                    if(obj.length>1){
                        $.alert('只能上传一张授权书');
                        return;
                    }
                    if(obj.length ==1){
                        $("#uploader-files  li").each(function(index){
                            var url=$(this).css('background-image');
                            arr= url.split('("')[1].split('")')[0];
                        })
                    }
                    $.ajax({
                        type: 'POST',
                        url: "{:url('insurer/confirmSubmit')}",
                        data: {
                            'policy_num': poliecy,
                            'author_report':arr
                        },
                        dataType: 'json',
                        success: function (Json) {
                            console.log(Json);
                            if (Json.code == 200) {
                                $.alert('提交审核成功');
                                location.href = "{:url('insurer/getList')}";
                            } else {
                                $.alert(Json.msg);
                            }
                        }
                    });
                });

            });

            $(document).on('click', '.blue', function () {
                location.href="{:url('index/test6')}"
            })
        });
        //获取对象
        function handleInputChange1(event) {
            //   console.log(event)
            var formData= handleInputChange(event);
            console.log(formData);
            uploadImg(formData);

        }
        // 上传图片
        function  uploadImg (formData) {
            $.ajax({
                type: 'POST',
                url: "{:url('upload/index')}",
                data: formData,
                processData: false,
                contentType: false,
                cache: false,
                success: function (Json) {
                    if (Json.code == 200) {
                        var url=decodeURI(Json.data.url)
                        var obj=url.lastIndexOf("/");
                        var name =url.substr(obj+1);
                        a="<li class=\"uploader-file\" style=\"background-image:url('"+url+"')\">";
                        a+= "<span class=\"close\" onclick='deleteT(this) '>x</span>"
                        a+= "</li>"
                        a+= "</li>"
                        $('#uploader-files').append(a);
                    } else {
                        $.alert('上传失败');
                    }
                }
            });
        }
        function deleteT(obj) {
            $(obj).parent('li').remove();

        }


    </script>
</body>

</html>